package cn.doitedu.serde;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class PersonWritable implements Writable {

    private String name;
    private int age;
    private double height;


    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeDouble(height);
        dataOutput.writeInt(age);
        dataOutput.writeUTF(name);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {

        this.height = dataInput.readDouble();
        this.age = dataInput.readInt();
        this.name = dataInput.readUTF();


    }
}
